﻿<%@ Page Title="Parts - Incoming Payments" Language="C#" MasterPageFile="~/Main.Master"
    AutoEventWireup="true" CodeBehind="IncomingPayment.aspx.cs" Inherits="VSM.Parts.IncomingPayment" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function OpenBP() {

            var url = "../../../BPPopup.aspx?CardType=C";
            Main.openCustomDialog(url, 600, 610, "Customers");
        }

        function OpenAccount(accountCode) {
            var url = "../../../AccountPopup.aspx?AccountCode=" + accountCode;
            Main.openCustomDialog(url, 600, 610, "G/L Account");
        }

        function OpenDocList(docktype, payNoDoc) {
            var url = "../../../DocumentList.aspx?DocType=" + docktype + "&PayNoDoc=" + payNoDoc + "&Depart=PAR"
            Main.openCustomDialog(url, 800, 610, "Incoming Payments List");
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hdnIsUpdate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <h2>
                    &nbsp;<asp:Label ID="lblTitle" runat="server" Text="Parts - Incoming Payments"></asp:Label>
                </h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 10%;">
                                Inc. No.:
                            </td>
                            <td style="width: 20%;">
                                <asp:TextBox ID="txtIncNo" runat="server" BackColor="#E6E6E6" ReadOnly="True" Width="100px"></asp:TextBox>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 100px;">
                                Due Date:
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtDueDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtDueDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                    PopupButtonID="imgDueDate" TargetControlID="txtDueDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgDueDate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                            <td>&nbsp;</td>
                            <td>
                                
                                </td>
                            <td align="right">
                                <asp:Button ID="btnDocList" runat="server" BorderStyle="Solid" OnClientClick="OpenDocList('24','N'); return false;"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;"
                                    Text="List" Width="60px" />
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; height: 7px">
                                Posting Date:
                            </td>
                            <td style="height: 7px">
                                <asp:TextBox ID="txtPostingDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtPostingDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                    PopupButtonID="imgPostingDate" TargetControlID="txtPostingDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPostingDate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; height: 7px">
                                Doc. Date:
                            </td>
                            <td >
                                <asp:TextBox ID="txtDocDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtDocDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                    PopupButtonID="imgDocDate" TargetControlID="txtDocDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgDocDate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                            <td>&nbsp;</td>
                            <td>
                                &nbsp;</td>
                            <td></td>
                        </tr>

                    </table>
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" style="white-space: nowrap; width: 10%" valign="middle">
                                Customer:
                            </td>
                            <td class="FormLineItemAlt" style="width: 40%;">
                                <asp:TextBox ID="txtCustomerCode" runat="server" ReadOnly="True" Width="100px" BackColor="#E6E6E6"></asp:TextBox>
                                <asp:TextBox ID="txtCustomerName" runat="server" Width="376px"></asp:TextBox>
                                <asp:Button ID="btnSelectBP" runat="server" OnClientClick="OpenBP(); return false;"
                                    Text="..." Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;
                                    font-weight: bold" Width="30px" />
                            </td>
                            <td class="FormLineItemAlt" style="width: 10%;">
                                Payment Means:
                            </td>
                            <td class="FormLineItemAlt">
                                <asp:DropDownList ID="ddlPaymentMeans" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPaymentMeans_SelectedIndexChanged">
                                    <asp:ListItem Value="B">Bank Transfer</asp:ListItem>
                                    <asp:ListItem Value="C">Cash</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle" style="width: 10%">
                                <asp:Label ID="lblConPersonName" runat="server">Contact Person:</asp:Label>
                            </td>
                            <td class="FormLineItem">
                                <asp:TextBox ID="txtCntctName" Width="86%" runat="server"></asp:TextBox>
                            </td>
                            <td class="FormLineItem" style="width: 10%;">
                                &nbsp;</td>
                            <td class="FormLineItem">
                                <asp:TextBox ID="txtAccountCode" runat="server" BackColor="#E6E6E6" ReadOnly="True"
                                    Width="100px" Visible="False"></asp:TextBox>
                                <asp:TextBox ID="txtAccountName" runat="server" Width="250px" Visible="False"></asp:TextBox>
                                <asp:Button ID="btnGLAccount" runat="server" OnClientClick="OpenAccount(112); return false;"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;
                                    font-weight: bold" Text="..." Visible="False" Width="30px" />
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="top" style="width: 10%">
                                <asp:Label ID="lblBillTo" runat="server">Bill To:</asp:Label>
                            </td>
                            <td class="FormLineItemAlt">
                                <asp:TextBox ID="txtBillTo" TextMode="MultiLine" runat="server" Width="86%" Height="60px"></asp:TextBox>
                            </td>
                            <td class="FormLineItemAlt" colspan="2">
                            </td>
                        </tr>
                    </table>
                    <hr />
                    <div style="width: 100%">
                        <asp:GridView ID="grvIncPmt" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" OnRowEditing="EditItem"
                            OnRowUpdating="UpdateItem" HeaderStyle-VerticalAlign="Middle" OnRowCancelingEdit="CancelEdit"
                            AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" PageSize="20"
                            OnRowDeleting="DeleteItem" OnRowDataBound="grvSearchResult_RowDataBound">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Selected">
                                    <ItemStyle HorizontalAlign="Center" Width="60px" />
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkheader" runat="server" OnCheckedChanged="chkAllSelected_CheckedChanged"
                                            AutoPostBack="true" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkSelected" Checked="false" OnCheckedChanged="chkSelected_CheckedChanged"
                                            AutoPostBack="true" runat="server" BorderStyle="none"></asp:CheckBox>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Document No">
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblDocument" runat="server" Text='<%# Bind("DocNum") %>' BorderStyle="none"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Doc Type" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblDocType" runat="server" Text='<%# Bind("InvType") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Date">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblDate" runat="server" Text='<%# Bind("RefDate", "{0:dd/MM/yyyy}")%>'
                                            BorderStyle="none"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Due Date">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblDueDate" runat="server" Text='<%# Bind("DueDate", "{0:dd/MM/yyyy}")%>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Overdue Days">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblOverdue" runat="server" Text='<%# Eval("Overdue") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Balance Due">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="200px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbBalanceDue" runat="server" Text='<%#String.Format("{0,-15:#,##0.00}", Eval("BalDueDeb"))%>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="ACR Date">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="200px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtPacrDate" runat="server" Text='<%# Bind("U_PACRDate", "{0:dd/MM/yyyy}")%>'
                                            BorderStyle="none" Style="text-align: center;"/>
                                            <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yyyy"
                                    PopupButtonID="imgACRDate" TargetControlID="txtPacrDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgACRDate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                  <asp:TemplateField HeaderText="ACR">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" Width="200px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtParc" runat="server" Text='<%#String.Format("{0,-15:#,##0.00}", Eval("U_PACR"))%>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Total Payments">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="200px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbTotalPaymets" runat="server" Width="97%" Text='<%#String.Format("{0,-15:#,##0.00}", Eval("SumApplied"))%>'
                                            Style="text-align: right" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="DocLine" Visible="false">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="80px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblDocLine" runat="server" Text='<%# Bind("DocLine") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#6095C9" ForeColor="#ffffff" Font-Overline="False" Height="27px"
                                VerticalAlign="Middle" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all"
                                    cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <th>
                                            <span>Selected</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                        <th>
                                            <span>Document No</span>
                                        </th>
                                        <th>
                                            <span>Document Type</span>
                                        </th>
                                        <th>
                                            <span>Date</span>
                                        </th>
                                        <th>
                                            <span>Due Date</span>
                                        </th>
                                        <th>
                                            <span>Overdue Days</span>
                                        </th>
                                        <th>
                                            <span>Balance Due</span>
                                        </th>
                                         <th>
                                            <span>ARC Date</span>
                                        </th>
                                         <th>
                                            <span>Paid Documents</span>
                                        </th>
                                        <th>
                                            <span>Total Payments</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="11">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
                    <hr width="100%" />
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td valign="top" style="width: 300px;">
                            <table>
                                <tr>
                                    <td>
                                        <strong>Remarks :</strong>
                                    </td>
                                    <td>
                                        <asp:TextBox runat="server" ID="txtRemarks" Height="71px" TextMode="MultiLine" Width="400px"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td align="right">
                            <div style="margin-right: 5px;">
                                <table border="0">
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none;
                                        background-color: #D9E0ED;">
                                        <td align="right">
                                            <asp:CheckBox ID="chkPmtOnAccount" AutoPostBack="true" runat="server" Text="Payment Account"
                                                OnCheckedChanged="chkPmtOnAccount_CheckedChanged" />
                                        </td>
                                        <td style="width: 150px" align="right">
                                            <asp:TextBox ID="txtPaymentAccount" runat="server" Font-Bold="True" Style="text-align: right;"
                                                ForeColor="Red" BorderStyle="None" AutoPostBack="True" Text="0.00" OnTextChanged="txtPaymentAccount_TextChanged"
                                                Visible="False">0.00</asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none;
                                        background-color: #D9E0ED;">
                                        <td align="right">
                                            Total Amount Due
                                        </td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblTotalAmountDue" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none;
                                        background-color: rgb(96, 149, 201);">
                                        <td align="right">
                                            Open Balance
                                        </td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblOpenBalance" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="margin-left: 5px; width: 99%;">
                                <hr />
                            </div>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 400px;">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnSave_Click" BorderStyle="Solid"
                                            Width="60px" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" OnClick="btnCancel_Click"
                                            Width="60px" />
                                        <asp:Button ID="btnPrint" runat="server" BorderStyle="Solid" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" Text="Print" Width="60px" />
                                        <asp:Button ID="btnLastRecord" runat="server" BorderStyle="Solid" OnClick="btnLastRecord_Click"
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;
                                            color: White;" Text="&gt;&gt;" ToolTip="Last record" Width="40px" />
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
